/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.logikas.hipokrates.server.domain.hl7;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author csrinaldi
 */
@Entity
@Table(name = "Hl7LivingSubject")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Hl7LivingSubject.findAll", query = "SELECT h FROM Hl7LivingSubject h"),
    @NamedQuery(name = "Hl7LivingSubject.findByIdEntity", query = "SELECT h FROM Hl7LivingSubject h WHERE h.idEntity = :idEntity"),
    @NamedQuery(name = "Hl7LivingSubject.findByBirthTime", query = "SELECT h FROM Hl7LivingSubject h WHERE h.birthTime = :birthTime"),
    @NamedQuery(name = "Hl7LivingSubject.findByDeceasedInd", query = "SELECT h FROM Hl7LivingSubject h WHERE h.deceasedInd = :deceasedInd"),
    @NamedQuery(name = "Hl7LivingSubject.findByDeceasedTime", query = "SELECT h FROM Hl7LivingSubject h WHERE h.deceasedTime = :deceasedTime"),
    @NamedQuery(name = "Hl7LivingSubject.findByMultipleBirthInd", query = "SELECT h FROM Hl7LivingSubject h WHERE h.multipleBirthInd = :multipleBirthInd"),
    @NamedQuery(name = "Hl7LivingSubject.findByMultipleBirthOrderNumber", query = "SELECT h FROM Hl7LivingSubject h WHERE h.multipleBirthOrderNumber = :multipleBirthOrderNumber"),
    @NamedQuery(name = "Hl7LivingSubject.findByOrganDonorInd", query = "SELECT h FROM Hl7LivingSubject h WHERE h.organDonorInd = :organDonorInd")})
public class Hl7LivingSubject implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id_entity")
    private Long idEntity;
    @Basic(optional = false)
    @Column(name = "birthTime")
    @Temporal(TemporalType.TIME)
    private Date birthTime;
    @Basic(optional = false)
    @Column(name = "deceasedInd")
    private boolean deceasedInd;
    @Column(name = "deceasedTime")
    @Temporal(TemporalType.TIME)
    private Date deceasedTime;
    @Column(name = "multipleBirthInd")
    private Boolean multipleBirthInd;
    @Column(name = "multipleBirthOrderNumber")
    private Integer multipleBirthOrderNumber;
    @Basic(optional = false)
    @Column(name = "organDonorInd")
    private boolean organDonorInd;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "hl7LivingSubject")
    private Hl7Person hl7Person;
    @JoinColumn(name = "id_entity", referencedColumnName = "id", insertable = false, updatable = false)
    @OneToOne(optional = false)
    private Hl7Entity hl7Entity;

    public Hl7LivingSubject() {
    }

    public Hl7LivingSubject(Long idEntity) {
        this.idEntity = idEntity;
    }

    public Hl7LivingSubject(Long idEntity, Date birthTime, boolean deceasedInd, boolean organDonorInd) {
        this.idEntity = idEntity;
        this.birthTime = birthTime;
        this.deceasedInd = deceasedInd;
        this.organDonorInd = organDonorInd;
    }

    public Long getIdEntity() {
        return idEntity;
    }

    public void setIdEntity(Long idEntity) {
        this.idEntity = idEntity;
    }

    public Date getBirthTime() {
        return birthTime;
    }

    public void setBirthTime(Date birthTime) {
        this.birthTime = birthTime;
    }

    public boolean getDeceasedInd() {
        return deceasedInd;
    }

    public void setDeceasedInd(boolean deceasedInd) {
        this.deceasedInd = deceasedInd;
    }

    public Date getDeceasedTime() {
        return deceasedTime;
    }

    public void setDeceasedTime(Date deceasedTime) {
        this.deceasedTime = deceasedTime;
    }

    public Boolean getMultipleBirthInd() {
        return multipleBirthInd;
    }

    public void setMultipleBirthInd(Boolean multipleBirthInd) {
        this.multipleBirthInd = multipleBirthInd;
    }

    public Integer getMultipleBirthOrderNumber() {
        return multipleBirthOrderNumber;
    }

    public void setMultipleBirthOrderNumber(Integer multipleBirthOrderNumber) {
        this.multipleBirthOrderNumber = multipleBirthOrderNumber;
    }

    public boolean getOrganDonorInd() {
        return organDonorInd;
    }

    public void setOrganDonorInd(boolean organDonorInd) {
        this.organDonorInd = organDonorInd;
    }

    public Hl7Person getHl7Person() {
        return hl7Person;
    }

    public void setHl7Person(Hl7Person hl7Person) {
        this.hl7Person = hl7Person;
    }

    public Hl7Entity getHl7Entity() {
        return hl7Entity;
    }

    public void setHl7Entity(Hl7Entity hl7Entity) {
        this.hl7Entity = hl7Entity;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idEntity != null ? idEntity.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Hl7LivingSubject)) {
            return false;
        }
        Hl7LivingSubject other = (Hl7LivingSubject) object;
        if ((this.idEntity == null && other.idEntity != null) || (this.idEntity != null && !this.idEntity.equals(other.idEntity))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.logikas.hipokrates.server.domain.hl7.Hl7LivingSubject[ idEntity=" + idEntity + " ]";
    }
    
}
